<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue组件data为什么必须是个函数？</title>
</head>
<body>
<div id="demo">
    <h1>vue组件data为什么必须是个函数？</h1>
    <comp></comp>
    <comp></comp>
</div>
<script src="./js/vue.js"></script>
<script>
    /**
     * 我的居然没有报错提示！
     */

    Vue.component('comp', {
        template: `<div @click="counter++">{{counter}}</div>`,
        data () {
            return {
                counter: 1
            }
        }
    })

    // 创建实例
    const app = new Vue({
        el: '#demo'
    })

</script>
<script>

</script>
</body>
</html>
